package com.ls.lserp.modules.material.dao;

import java.util.List;

import com.ls.lserp.common.persistence.CrudDao;
import com.ls.lserp.common.persistence.annotation.MyBatisDao;
import com.ls.lserp.modules.common.entity.Material;
import com.ls.lserp.modules.common.entity.UploadFile;
import com.ls.lserp.modules.material.entity.InventoryRequest;
import com.ls.lserp.modules.material.entity.InventoryRequestEx;
import com.ls.lserp.modules.order.entity.BarCode;
import com.ls.lserp.modules.setting.entity.Ognization;
import com.ls.lserp.modules.sys.entity.Brand;


/**
  * @ClassName: MaterialDao
  * @Description: 物料接口
  * 
  * @author 
  * @date 2016年1月19日 上午9:20:34
  *
  */

@MyBatisDao
public interface AMaterialDao extends CrudDao<Material> {

	
	/**
	  * @Title: getByName
	  * @Description: 查重
	  * @param @param Material
	  * @param @return
	  * @return Material 
	  * @throws
	  */
	
	public Material getByCode(Material material);
	
	/**
	  * @Title: saveUploadFile
	  * @Description: 上传图片
	  * @param @param material
	  * @param @return
	  * @return int 
	  * @throws
	  */
	
	public int saveUploadFile(UploadFile  uploadFile);
	
    /**
      * @Title: searchFileId
      * @Description: 查询图片Id
      * @param @param material
      * @param @return
      * @return List<Material> 
      * @throws
      */
    
    public List<UploadFile> searchFileId(UploadFile  uploadFile);
    
	/**
	  * @Title: findMaterialOgnizationList
	  * @Description: 物料来源机构一览
	  * @param @return
	  * @return List<Ognization> 
	  * @throws
	  */
	public List<Ognization> findMaterialOgnizationList(Material material);
	
	/**
	 * 供货商物料表
	 * @param material
	 * @return
	 */
	public int insertVenderMaterial(Material material);
	
	/**
	 * 供货商物料表
	 * @param material
	 * @return
	 */
	public int updateVenderMaterial(Material material);
	/**
	 * 品牌列表
	 * @param Brand
	 * @return
	 */
	public List<Brand> findBrandList();
	
	/**
	 * 扣号列表
	 * @return
	 */
	public List<Material> findButtonList();
	/**
	 * 获取机构
	 * @param material
	 * @return
	 */
	public Ognization getMaterialOgnization(Material material);
	/**
	 * 供货商物料表
	 * @param material
	 * @return
	 */
	public int insertiInventoryMaterial(Material material);
	/**
	 * 条码code表
	 * @param material
	 * @return
	 */
	public int insertBarCode(Material material);
	/**
	  * @Title: getByName
	  * @Description: 查存
	  * @param @param Material
	  * @param @return
	  * @return Material 
	  * @throws
	  */
	
	public Material findVenderMaterial(Material material);
	
	 /**
     * excel导入(原辅料信息表插入)
     * @param order
     * @return
     */
	public void inserMaterial(Material material);

	 /**
     * excel导入(辅料客户关联表)
     * @param orderId
     * @param styleId
     * @return
     */
	public void inserMatAndOgn(Material material);
	/**
     * excel导入(原辅料库存表插入)
     * @param order
     * @return
     */
	public void inserInventoryMat(Material material);
	 
	/**
	  * @Title: getByName
	  * @Description: excel查存
	  * @param @param Material
	  * @param @return
	  * @return Material 
	  * @throws
	  */
	
	public Material findMaterialExcel(String code);
	 // 品牌id查询
	public Material selectBrankId(Material material);
	// 品牌中文名查询
	public List<Brand> selectBrankNameCn(Material material);
	// excel导入(条码code表插入)
	public void insertQRBarCode(BarCode barCode);
	

	
	/**
	 * 入库申请单
	 * @param inventoryRequest
	 * @return
	 */
	public int insertInventoryRequest(InventoryRequest inventoryRequest);
	
	/**
	 * 入库申请单详细
	 * @param inventoryRequest
	 * @return
	 */
	public int insertInventoryRequestDetails(InventoryRequest inventoryRequest);
	
	/**
	 * 入库申请单详细
	 * @param inventoryRequest
	 * @return
	 */
	public int updateInventoryRequestDetails(InventoryRequest inventoryRequest);
	

	/**
	 * 出库申请单
	 * @param inventoryRequestEx
	 * @return
	 */
	public int insertInventoryRequestEx(InventoryRequestEx inventoryRequestEx);
	
	/**
	 * 出库申请单详细
	 * @param inventoryRequest
	 * @return
	 */
	public int insertInventoryRequestExDetails(InventoryRequestEx inventoryRequestEx);
	
	/**
	 * 出库申请单详细
	 * @param inventoryRequest
	 * @return
	 */
	public int updateInventoryRequestExDetails(InventoryRequestEx inventoryRequestEx);
	
	/**
	 * 入出库申请单详细
	 * @param inventoryRequest
	 * @return
	 */
	public int insertMaterialDetail(InventoryRequestEx inventoryRequestEx);
	
	/**
	 * 入出库申请单详细
	 * @param inventoryRequest
	 * @return
	 */
	public int insertMaterialDetail(InventoryRequest inventoryRequest);
	
	/**
	 * 查存
	 * @param material
	 * @return
	 */
	public Material findMaterialExist(Material material);
	
	/**
	 * 查询库存数量
	 * @param material
	 * @return
	 */
	public Double findMaterialQuntity(Material material);
	
	/**
	 * 查询库存数量
	 * @param material
	 * @return
	 */
	public Double findMaterialQuntityOut(Material material);
	
	/**
	 * 明细查存
	 * @param material
	 * @return
	 */
	public Long findMaterialDetailExist(Long materialId,Long inventoryRequestId);
	
	/**
	 * 明细查存
	 * @param material
	 * @return
	 */
	public Long findMaterialExDetailExist(Long materialId,Long inventoryRequestExId);
	
	/**
	 * 获取
	 * @param material
	 * @return
	 */
	public String getCustomSimpleName(String customId);
	
	/**
	 * 库存增加
	 * @param inventoryRequest
	 * @return
	 */
	public int plusQuantity(InventoryRequest inventoryRequest);
	
	/**
	 * 库存减少
	 * @param inventoryRequestEx
	 * @return
	 */
	public int minusQuantity(InventoryRequestEx inventoryRequestEx);
	
	/**
	 * 获取仓库货架
	 * 
	 * @return
	 */
	public List<InventoryRequest> checkWarehouseRack();
	
	/**
	 * 获取客户品牌
	 * 
	 * @return
	 */
	public List<InventoryRequestEx> checkVenderBrand();
	
	/**
	 * 面料ID获取出入库信息
	 * 
	 * @return
	 */
	public List<Material> findInOutDetail(Material material);
	/**
	 * 面料ID获取库存信息
	 * 
	 * @return
	 */
	public List<Material> findStockDetail(Material material);
	
	/**
	 * 获取面料信息
	 * 
	 * @return
	 */
	public Material getMaterialInfo(Material material);
	
	void updateRemarks(String inventoryDetailID, String remarks);
	
	
}
